package com.lcw.lostandfound.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lcw.lostandfound.mapper.ThankMapper;
import com.lcw.lostandfound.pojo.Thank;
import com.lcw.lostandfound.service.ThankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ThankServiceImpl implements ThankService {

    @Autowired
    private ThankMapper thankMapper;
    @Override
    public List<Thank> findAllThank() {
        return thankMapper.findAllThank();
    }

    @Override
    public List<Thank> findWallsThank() {
        return thankMapper.findWallsThank();
    }

    @Override
    public int insertThank(Thank thank) {
        return thankMapper.insertThank(thank);
    }

    @Override
    public Thank findById(Integer id) {
        return thankMapper.findById(id);
    }

    @Override
    public Thank findByTitle(String title) {
        return thankMapper.findByTitle(title);
    }

    @Override
    public int deleteById(Integer id) {
        return thankMapper.deleteById(id);
    }

    @Override
    public PageInfo<Thank> listThanks(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Thank> allThank = thankMapper.findAllThank();
        return new PageInfo<>(allThank);
    }


}
